package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.WeixinQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.WeixinDao;
import com.bbdjt.weixin.model.Weixin;
import com.bbdjt.weixin.service.WeixinService;

@Service("weixinService")
public class WeixinServiceImpl extends BaseServiceImpl<Weixin> implements WeixinService {
	
	@Override
    public List<Weixin> selectByWeixin(Weixin weixin, int page, int rows) {
        Example example = new Example(Weixin.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(weixin);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Weixin> selectByWeixin(Weixin weixin) {
        Example example = new Example(Weixin.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(weixin);
        return selectByExample(example);
    }

    @Override
    public PageInfo<WeixinQueryModel> selectByWeixinQueryModel(WeixinQueryModel weixin) {
    	return ((WeixinDao) getMapper()).selectByWeixinModel(weixin);
    }

	@Override
	public List<Weixin> selectByWeixin(WeixinQueryModel weixin) {
		  Example example = new Example(Weixin.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(weixin);
	        PageHelper.startPage(weixin.getPageNum(), weixin.getPageSize(),weixin.getOrderBy());
	        return selectByExample(example);
	}

	@Override
	public Weixin selectByPatient(Weixin weixin) {
		return ((WeixinDao) getMapper()).selectByPatient(weixin);
	}

	
}